//package com.wave.traffic.task;
//
//import com.wave.traffic.NetSDKDemo.FMSGCallBack_V31;
//import com.wave.traffic.NetSDKDemo.FMSGCallBack_V32;
//import com.wave.traffic.enums.NetControllerEnum;
//import com.wave.traffic.util.SocketClientUtil;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import java.net.Socket;
//
///***
// * @Description 雷视摄像机监控任务
// * @Author linhui
// * @Date 2022/9/28 10:00
// */
//public class HKCameraTaskOld extends Thread {
//    private final static Logger logger = LoggerFactory.getLogger(HKCameraTaskOld.class);
//    @Autowired
//    private ServerInfo serverInfo;
//    public volatile static boolean hasCar = true;
//
//    public HKCameraTaskOld(ServerInfo serverInfo) {
//        this.serverInfo = serverInfo;
//    }
//
//    @Override
//    public void run() {
//        try {
//            Socket netController1 = new Socket(serverInfo.getServerIP1(), serverInfo.getServerPort1());
//            Socket netController2 = new Socket(serverInfo.getServerIP2(), serverInfo.getServerPort2());
//            Socket netController3 = new Socket(serverInfo.getServerIP3(), serverInfo.getServerPort3());
//            while (true) {
////                logger.info("BBBBBBBBBBB");
////            logger.info("摄像头1检测车辆状态:{},摄像头2检测车辆状态:{}", FMSGCallBack_V31.isVehicle(), FMSGCallBack_V32.isVehicle());
//                //有车就关闭红外感应，无车则打开红外感应
//                if (FMSGCallBack_V31.isVehicle() || FMSGCallBack_V32.isVehicle()) {
//                    logger.info("有车,休眠15秒开始");
//                    SocketClientUtil.sendData(netController1, NetControllerEnum.WRITE_DO4_OPEN_COMMAND.getCode());
//                    SocketClientUtil.sendData(netController2, NetControllerEnum.WRITE_DO4_OPEN_COMMAND.getCode());
//                    SocketClientUtil.sendData(netController3, NetControllerEnum.WRITE_DO4_OPEN_COMMAND.getCode());
//                    hasCar = true;
//                    try {
//                        Thread.sleep(1000 * 15);
//                        logger.info("有车，休眠15秒结束");
//                    } catch (InterruptedException e) {
//                        logger.error("HKCameraTask sleep error:[{}]", e.getMessage(), e);
//                    }
//                    FMSGCallBack_V31.resetVehicle();
//                    FMSGCallBack_V32.resetVehicle();
//                    continue;
//                } else {
////                    logger.info("没有车");
//                    // 打开红外感应
//                    hasCar = false;
//                    SocketClientUtil.sendData(netController1, NetControllerEnum.WRITE_DO4_CLOSE_COMMAND.getCode());
//                    SocketClientUtil.sendData(netController2, NetControllerEnum.WRITE_DO4_CLOSE_COMMAND.getCode());
//                    SocketClientUtil.sendData(netController3, NetControllerEnum.WRITE_DO4_CLOSE_COMMAND.getCode());
//                }
////            logger.info("是否有车：{}",hasCar);
//            }
//        } catch (Exception e) {
//            logger.error("HKCameraTask error:[{}]", e.getMessage(), e);
//        }
//
//    }
//}
